{% extends 'fruitShop/base_buttom.html' %}
{% load static %}
{% block body %}

	<div class="login_top clearfix">
		<a href="/" class="login_logo"><img src="{% static 'fruitShop/images/logo02.png' %}"></a>
	</div>

	<div class="login_form_bg">
		<div class="login_form_wrap clearfix">
			<div class="login_banner fl"></div>
			<div class="slogan fl">日夜兼程 · 急速送达</div>
			<div class="login_form fr">
				<div class="login_title clearfix">
					<h1>用户登录</h1>
					<a href="{% url 'fruitShop:user_register' %}">立即注册</a>
				</div>
				<div class="form_input">
					<form method="post" action="{% url 'fruitShop:user_login' %}">
						<input type="text" name="username" class="name_input" value="{{ nickname }}" placeholder="请输入用户名">
						<div class="user_error">输入错误</div>
						<input type="password" name="pwd" class="pass_input" value="{{ pwd }}" placeholder="请输入密码">
						<div class="pwd_error">输入错误</div>
						<div class="more_input clearfix">
							<input type="checkbox" name="remember" value="1" checked="checked">
							<label>记住用户名</label>
							<a href="javascript:;">忘记密码</a>
						</div>
                        {% csrf_token %}
						<input type="submit" name="" value="登录" class="input_submit">
					</form>
				</div>
			</div>
		</div>
	</div>

{% endblock %}

{% block js %}

<script>
        if('{{ nickname_error }}'){
            $(".user_error").html('{{ nickname_error }}').show()
        }
        if('{{ password_error }}'){
            $(".pwd_error").html('{{ password_error }}').show()
        }

        $('.name_input').blur(function() {
            if($(this).val().length==0){
                $(".user_error").html('用户名不能为空').show();
            }
        });
        $('.pass_input').blur(function() {
            if($(this).val().length==0){
                $(".pwd_error").html('密码不能为空').show();
            }
        });
    </script>

{% endblock %}